#include <stdio.h>
#include <math.h>

int main(void)
{
	double a, b, c, d, e, x1, x2, real, imaginary;

	printf("Input a, b, c: ");
	scanf("%lf%lf%lf", &a, &b, &c);
	d = b * b - 4 * a * c;

	if (0 == a)
		if (0 == b)
			printf("error!\n");
		else
			printf("x = %f\n", -c / b);
	else if (0 == d)
	{
		x1 = x2 = -b / (2 * a);
		printf("x1 = x2 = %f\n", x1);
	}
	else if (d > 0)
	{
		e = sqrt(d);
		x1 = (-b + e) / (2 * a);
		x2 = (-b - e) / (2 * a);
		printf("x1 = %f\n", x1);
		printf("x2 = %f\n", x2);
	}
	else
	{
		e = sqrt(-d);
		real = -b / (2 * a);
		imaginary = e / (2 * a);
		printf("x1 = %f + %fi\n", real, imaginary);
		printf("x1 = %f - %fi\n", real, imaginary);
	}

	return 0;
}